package com.weimob.mcloud.wechatwork.customer.third.passport;

import com.alibaba.dubbo.config.annotation.Reference;
import com.weimob.mcloud.wechatwork.core.adapter.pojo.dto.passport.PhoneAndZoneAndWidResponse;
import com.weimob.mcloud.wechatwork.core.adapter.service.passport.PassPortAccountFetchService;
import com.weimob.mcloud.wechatwork.customer.service.user.utils.SoaResponseUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import java.util.Collections;
import java.util.List;

/**
 * passport账户查询相关接口对接
 *
 * @Author LeoLee
 * @Date 2022/6/20 14:13
 * @Version 1.0
 */
@Component
@Slf4j
public class PassPortAccountFetchProxy {

    @Reference
    private PassPortAccountFetchService passPortAccountFetchService;

    /**
     * 根据手机号查询wid信息
     * @Author LeoLee
     * @Date 15:02 2022/6/20
     * @param phoneList
     * @return java.util.List<com.weimob.mcloud.wechatwork.core.adapter.pojo.dto.passport.PhoneAndZoneAndWidResponse>
     */
    public List<PhoneAndZoneAndWidResponse> batchGetWidByPhoneAndZone(List<String> phoneList) {
        if (CollectionUtils.isEmpty(phoneList)) {
            return Collections.emptyList();
        }
        return SoaResponseUtil.unpack(passPortAccountFetchService.batchGetWidByPhoneAndZone(phoneList));
    }
}
